|
|
|
|
|
|
|
This routine simply initializes the data connection between the class object and the database that holds the security tables. |
|
|
|
|
|
|
|
|
You need only one more routinethe LogUser routine. This procedure just needs to locate the requested user record and update the LastLogIn or LastLogOut fieldsdepending on the parameter passed. Create a new function called usrLogOut and add the code from Listing 21.18. |
|
|
|
|
|
|
|
|
Listing 21.18. Adding the LogUser routine. |
|
|
|
|
|
|
|
|
Public Sub LogUser(urAction As urUserAction)
'
' make entry in the user table
'
On Error GoTo LocalErr
'
Dim strAction As String
'
If urAction = urLogIn Then
strAction = "In"
Else
strAction = "Out"
End If
'
If blnUsersLoaded = False Then
LoadUsers
End If
'
With rsUsers
.FindFirst "UserID='" & strUserIDProp & "'"
If .NoMatch = False Then
.Edit
.Fields("LastLog" & strAction) = Now()
.Update
End If
End With
'
Exit Sub
'
LocalErr:
Err.Raise Err.Number, App.EXEName & ".usrObject", Err.Description
'
End Sub |
|
|
|
|
|
|
|
|
There is a line in the UserLogin method that saves a copy of the UserID to a Public property of a BAS module. This is needed so that you can share the user ID with other class objects in this DLL (you build another one a bit later today). Add a BAS module to the DLL project. Set its Name to modUsrObject and save it as modUsrObject.bas. Now add the code from Listing 21.19 to this new module. |
|
|
|
|
|